import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class Test_2 {
    public static void main(String[] args) {

        StringBuffer stringBuffer= new StringBuffer("ss");
        //递归
        List<String> paths = new ArrayList<>();
        getAllFilePaths (new File("/Users/let-fan/Desktop/code/new_shop2/newshop"),paths);

        for(String path : paths){
            System.out.println(path);
        }
    }
    private static void getAllFilePaths(File file, List<String> paths) {
        File [] files = file.listFiles();
        if (files == null){
            return;
        }
        for (File f : files){
            if (f.isDirectory()){
                paths.add(f.getPath());
                getAllFilePaths(f,paths);
            }else {
                paths.add(f.getPath());
            }
        }
    }
}
